<template>
  <div class="detail">
    <header>
      <span @click="handleGo">&lt;</span>
      <p>国联大厦</p>
      <i class="icon iconfont icon-fenxiang1"></i>
    </header>
    <main>
      <!-- 轮播图 -->
      <div class="banner">
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
          <van-swipe-item v-for="(v, i) in obj.houseImg" :key="i">
            <img :src="'http://47.102.145.189:8009' + v" alt="" />
          </van-swipe-item>
        </van-swipe>
      </div>
      <div class="dll">
        <ul>
          <li>{{ obj.title }}</li>
          <li>
            <span v-for="(v, i) in obj.tags" :key="i">{{ v }}</span>
          </li>
        </ul>
      </div>
      <div class="zu">
       <dl>
         <dt>{{obj.price}}元/月</dt>
         <dd>租金</dd>
       </dl>
        <dl>
         <dt>{{obj.roomType}}</dt>
         <dd>房型</dd>
       </dl>
       <dl>
         <dt>{{obj.size}}平米</dt>
         <dd>面积</dd>
       </dl>
      </div>
      <div class="samll">
        <li>装修:{{obj.community}}</li>
        <li  v-for="(v,i) in obj.oriented" :key="i">朝向:{{v}}</li>
        <li>楼层:{{obj.size}}</li>
        <li>类型:{{obj.floor}}</li>
      </div>
      <!-- 地图 -->
      <div class="map">
        <p>{{obj.description}}</p>
      </div>
      <!-- 房屋配套 -->
      <div class="house">
        <h5>房屋配套</h5>
        <div class="total">
         <li v-for="(v,i) in obj.supporting" :key="i">
           <i class="icon iconfont icon-zanting3"></i>
           <span>{{v}}</span>
         </li>
        </div>
      </div>
    </main>
    <footer>
      <li>
   <i class="icon iconfont icon-tianbiao">
     收藏
   </i>
      </li>
      <li>在线咨询</li>
      <li class="first">电话预约</li>
    </footer>
  </div>
</template>

<script>
import axios from "../utils/request";
export default {
  data() {
    return {
      obj: {},
    };
  },
  created() {
    // console.log(this.$route.query.id,'id');
    const { id } = this.$route.query.id;
    axios.get(`/houses/${this.$route.query.id}`).then((res) => {
      console.log(res, "res");
      if (res.status === 200) {
        this.obj = res.data.body;
        console.log(this.obj);
      }
    });
  },
  methods:{
    handleGo(){
      this.$router.go(-1);
    }
  }
};
</script>

<style scoped lang="scss">
.detail{
 
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  main{
    flex:1;
    overflow-y: scroll;
  }
  footer{
    width: 100%;
  
    display: flex;
    justify-content: space-around;
     height: 50px;

  align-items: center;
  li{
    width: 30%;
    border-right:1px solid #ccc;
    text-align: center;
   line-height: 50px;
    font-size: 16px;
  }
 .first{
    background: #21b97a;
  }
  }
}
.house{
  margin-top: 0;
  width: 100%;
  padding: 10px;


  h5{
   line-height: 40px;
    border-bottom:1px solid #ccc;
    font-size: 16px;
  }
  .total{
    display: flex;
    flex-wrap: wrap;
    width: 90%;
    margin: 0 auto;
    li{
     margin: 10px 15px;
      i{
        font-size: 20px;
        display: block;
        margin: 6px auto;
      }
    }
  }
}
.detail {
  width: 100%;
  height: 100%;

  header {
    font-size: 16px;
    height: 50px;
    align-items: center;
    background: #21b97a;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    color: #fff;
  }
  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }
  .banner {
    width: 100%;
    .my-swipe {
      width: 100%;
      .van-swipe-item {
        width: 100px;
        height: 220px;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
.dll {
  width: 100%;
  ul {
    width: 90%;
    border-bottom: 1px solid #ccc;
    margin: 5px auto;
    li {
      line-height: 34px;
      font-size: 16px;
      span {
        background: #e1f5f8;
        color: #39becd;
        padding: 3px 4px;
        font-size: 12px;
        margin-top: 20px;
        margin-bottom: 20px;
      }
    }
  }
}
.zu{
  width: 90%;

  margin: 0 auto;
  border-bottom: 1px solid #ccc;
  display: flex;
  justify-content: space-around;
  dl{
   margin: 17px 0;
   dt{
     color: #fa5741;
   font-size: 16px;
    font-weight: bolder;
  
   }
   dd{
     margin: 0 auto;
     color:#ccc;
     font-size: 14px;
     margin: 6px 8px;
   }
  }
}
.samll{
  padding: 10px;
  margin: 0 auto;
  margin-top: 5px;

  width: 90%;
  border-bottom:1px solid #ccc;
  display: flex;
  flex-wrap: wrap;
  li{
   font-size: 14px;
    width: 45%;
margin-bottom: 10px;
  }
}
</style>